Skip to content

Conversation

@DPlayer234
Copy link

@DPlayer234 DPlayer234 commented Nov 19, 2025

Had some downtime and figured I'd poke around in here a bit. If wanted, I can split the commits into separate PRs, it was just more convenient to combine them for now.

The original Eq and Ord implementations were sensitive to the actual heap length of the bitset. However, since there can be trailing zero chunks, which wouldn't impact the logical value, bitsets with the same logical value could compare as inequal. In practice this could happen due to masking out high bits with an operator.

To do this, I added a small helper iterator that iterates over the logical chunks of the bitset small helper struct that provides access to the logical chunks of the bitset as a slice and added additional tests.

@fgardt
Copy link
Collaborator

fgardt commented Nov 19, 2025

Yeah having it as 2 separate PRs would be great.

I like the approach to solving the ops::Not issue tho! My attempt at solving it kind of ran into a wall (using another bit as a flag to denote if a SmolBitSet is currently negated or not).

@DPlayer234 DPlayer234 changed the title Fix logic for Eq and Ord and add and_not operator functions Fix logic for Eq and Ord Nov 19, 2025
@DPlayer234
Copy link
Author

Remove the and_not changes, but I also realized that the and_not changes are somewhat stacked on top of this since the test adjustments for that need the helper iterator used for equality here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants